﻿namespace RialternativeSample.Tests.Client.Mocks
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.ServiceModel.DomainServices.Client;
    using RialternativeSample.Server.NorthwindService;

    /// <summary>
    /// Provides a mock of the ProductManager DomainClient.
    /// </summary>
    public class NorthwindMockDomainClient : MockDomainClient
    {
        /// <summary>
        /// Mocks the specified query.
        /// </summary>
        /// <param name="query">The query.</param>
        /// <returns>
        /// The collection of entity returned by the query.
        /// </returns>
        protected override IEnumerable<Entity> MockQuery(EntityQuery query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            List<Entity> entities = new List<Entity>();
            switch (query.QueryName)
            {
                case "GetCustomers":
                    return new List<Customers>
                    {
                        new Customers { CustomerID = "CUSTEST01" }
                    }.Cast<Entity>();

                default:
                    break;
            }

            return entities;
        }
    }
}

